package com.dfdchem.imd.kaiwu.activity;

import android.os.Bundle;
import android.webkit.WebView;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.dfdchem.imd.kaiwu.R;
import com.dfdchem.imd.kaiwu.activity.base.BaseActivityAnon;
import com.dfdchem.imd.kaiwu.constant.RouterPath;
import com.dfdchem.imd.kaiwu.util.Log;

@Route(path = RouterPath.PAGE_ACTIVITY)
public class PageActivity extends BaseActivityAnon {

    private static final String TAG = "PageActivity";

    @Autowired
    String name;

    @Autowired
    String content;

    private TextView title;
    private WebView webView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_page);

        initView();
        initData();
        initEvent();
    }

    @Override
    public void initView() {
        title = findView(R.id.title);
        webView = findView(R.id.webView);
    }

    @Override
    public void initData() {
        title.setText(name);

        Log.d(TAG, "initData title:" + name + " content:" + content);
        webView.getSettings().setDefaultTextEncodingName("utf-8");
        webView.loadDataWithBaseURL(null, content, "text/html", "utf-8", null);
    }

    @Override
    public void initEvent() {

    }
}
